weave / op
Function: op()
op(fn, options)
op<A wrapper to weave op-ify a function or method that works on sync and async functions. Wrapped functions:T
>(fn
,options
?):Op
<(…args
) =>Promise
<Awaited
<ReturnType
<T
>>>>
- Take the same inputs and return the same outputs as the original function.
- Will automatically track calls in the Weave UI.
weave.init
then the function will behave as if it were not wrapped.
Type Parameters
• T extends (…args
) => any
Parameters
• fn:T
The function to wrap
• options?: OpOptions
<T
>
Optional configs like call and param naming
Returns
Op
<(…args
) => Promise
<Awaited
<ReturnType
<T
>>>>
The wrapped function
Example
Defined in
op.ts:58op(thisArg, fn, options)
op<T
>(thisArg
,fn
,options
?):Op
<(…args
) =>Promise
<Awaited
<ReturnType
<T
>>>>
Type Parameters
• T extends (…args
) => any
Parameters
• thisArg:any
• fn: T
• options?: OpOptions
<T
>
Returns
Op
<(…args
) => Promise
<Awaited
<ReturnType
<T
>>>>